<!--
 * Date: 2019年11月18日 16:13:17
 * LastEditors: lvyou
 * LastEditTime: 2019年12月13日 15:31:52
 * FilePath: \youlinweb-master\src\components\statistics\newone.vue
 * copyright(c) 2019-2025 版权为浙江双城网络科技集团有限公司所有，违者必究。
 -->
<template>
  <div class="bg1 bg3 a-c text-center">
    <img src="https://youlingqinius.wonderlandnet.cn/statistics-youlin-twomouse.gif" class="title1 twomouse" />
     <div class="new1-text-wrap flex-colum new3-text-wrap">
      <div class="flex">
        <img :src="form.headImg" class="statistics-avatar" />
        <div class="name-wrap v-c">
          <img src="https://youlingqinius.wonderlandnet.cn/statistics-youlin-new1-dear@2x.png" class="new1-dear" />
          <span class="statistics-nickname">{{form.nickName||form.name}}</span>
        </div>
      </div>
      <img src="https://youlingqinius.wonderlandnet.cn/statistics-youlin-new3-txt@2x.png" class="new3-text" />
      <img src="https://youlingqinius.wonderlandnet.cn/statistics-youlin-new3-share.gif" class="new3-share"  @click="goTopicDetail"/>
    </div>
  </div>
</template>

<script>
import api from "src/api/index";
export default {
  name: "newone",

  components: { api },

  props: {
    form: {
      type: Object,
      default: {}
    }
  },

  data() {
    return {
      popupVisible: true,
      isClick:false,
    };
  },


  watch: {},

  created() {},

  mounted() {},

  destroyed() {},

  methods: {
    goTopicDetail() {
      if(this.isClick){
        return
      }
      this.isClick=true;
      let that = this;
      const data = {
        topicId: this.form.topicId,
        parentId: "",
        type: 0,
        peplyId: "",
        content:"感谢第一次相遇，生活秀送了我第一份见面礼100绿币，你也赶紧去领吧！点击→?//:",
        picUrls: "",
        parentType: "",
        id: null,
        token: localStorage.getItem("token"),
        draft: 0 //草稿
      };
      api
        .QuerytopicAddComment(data)
        .then(res => {
          this.isClick=false;
          if (res.success) {
            that.$toast("发布讨论成功");
            if (this.form.receiveCoin == 0) {
              this.addCoin();
            } else {
              this.$router.push({
                path: "/topicdetail",
                query: { topicId: this.form.topicId }
              });
            }
          } else {
            that.$toast(res.msg);
          }
        })
        .catch(error => {
            this.isClick=false;
          //  that.showImg = true
        });
    },
    addCoin() {
      api.addCoin().then(res => {
        if (res.code != 0) {
          this.$toast(res.msg);
        } else {
          this.dialog(`恭喜您获得${res.data.receiveCoinNum || 0}绿币`);
          this.$router.push({
            path: "/topicdetail",
            query: { topicId: this.form.topicId }
          });
        }
      });
    }
  }
};
</script>

<style lang="less">
.statistics-container {
  .bg3 {
    background: url("https://youlingqinius.wonderlandnet.cn/statistics-youlin-bg3.png") no-repeat;
    background-size: 100% 100vh;
  }
  .new3-text-wrap{
    margin-top: 3rem;
    .new3-text{
      width: 4.76rem;
      height: 3.02rem;
      padding-top: 0.1rem;
      margin-bottom: 0.2rem;
    }
    .new3-share{
      width: 2.6rem;
      height: 0.76rem;
    }
  }
  .go-share {
    position: absolute;
    margin-left: -1.8rem;
    width: 3rem;
    height:1.8rem;
    bottom: 2.8rem;
    left: 2.2rem;
  }
}
</style>

